<link rel="stylesheet" type="text/css" href="../addons/jy_weishop_cutprice/resource/css/style.css">
<link rel="stylesheet" type="text/css" href="../addons/jy_weishop_cutprice/resource/css/bargain.css?v=20181212">
<style>
.time-item {margin:0 auto;width:100%;text-align:center;}
.time-item strong{border:#CCC 1px solid;background:#FFF;color:#999;line-height:40px;font-size:14px;padding:5px 10px;margin:0 5px;border-radius:3px;box-shadow:1px 1px 1px rgba(0,0,0,0.1);}
.day{line-height:35px;color:#999;font-size:12px;}
</style>
<style>
.fui-navbar .cartbtn {padding-right:0.3rem;background:#fff;opacity:1}
.fui-navbar .buybtn  {padding-left:0.3rem;background:#fff}
.fee-tag-nav, .fee-tagup-nav, .fee-disabled-nav {border-radius:1rem;height:2rem;line-height:1.95rem;color:#fff;width:100%;font-weight:400;font-size:0.7rem;margin:0.2rem 0;padding:0 0.2rem}
.fee-tagup {background:linear-gradient(to right,rgba(129,2,138,1),rgba(238,2,253,1));color:#fff;width:auto;font-weight:400;font-size:0.55rem}
.fee-tag-nav {background:linear-gradient(to right,rgba(211,5,5,1),rgba(255,8,8,1));}
.fee-tagup-nav {background:linear-gradient(to right,rgba(129,2,138,1),rgba(190,0,205,1));}
.fee-disabled-nav {background:#bbb;color:#fff;}	
</style>
<div class='fui-page-group'>
    <div class='fui-page fui-page-current'>  
        <div class='fui-content'>	
	<!--轮播图-->

	<div id="carousel-container" class="carousel slide" data-role="carousel" data-param-auto="true">
	<div class="carousel-inner" role="listbox" style="min-height:13rem;max-height:20rem">
		<div ng-class="{'item':1,'active':$index==0}" ng-repeat="item in pagedata.act.images">
			<a href="#">
				<img src="{{tomedia(item) || '../core/resource/images/banner-1.jpg'}}" style="display: block; width: 100%; height: 100%;">
			</a>
		</div>
	</div>
	<style>
            .fui-swipe-page .fui-swipe-bullet {background: {background}; opacity: {opacity};}
            .fui-swipe-page .fui-swipe-bullet.active {opacity: 1;}
    </style>
		<div id="carousel-jinyun" class="fui-swipe-page" style="padding: 0 5px; bottom: 10px; ">
				<div class="fui-swipe-bullet" ng-repeat="item in pagedata.act.images" ng-class="{'active':$index==0}" data-target="#carousel-container" data-slide-to="{{$index}}"></div>
		</div>
	</div>
            <div class="lynn_goods_head">
                <div class="lynn-goods-head-top fui-list">
                   
                    <div class="fui-list-inner">
                        现价：&yen;<strong>{{pagedata.act.nowprice}}</strong> 原价:<del>&yen;{{pagedata.act.original}}</del> 底价：<del>&yen;{{pagedata.act.stopprice}}</del>
                    </div>

                   
                    <div class="fui-list-media">
                        <i>{{pagedata.orders.count || '暂无'}}人竞拍成功</i>
                    </div>
                </div>
                <div class="lynn-goods-head-title fui-list">
                    <div class="fui-list-inner">
                        <h2>{{pagedata.act.title}}</h2>
                        <p>{{pagedata.act.goods.title}}</p>
                        <p>库存：{{pagedata.act.total}}</p>
                    </div>
                    <div class="fui-list-media">				
                        <a ng-click="pagedata.showrule=true" style="color:f60" data-nocache="true"><i class="icon jinyunicon icon-manageorder"></i><p>规则</p></a>
                    </div>
                </div>
				<div class="time-item">
					<div class="day">活动结束倒计时</div>
					<strong id="day_show">0天</strong>
					<strong id="hour_show"><s id="h"></s>0时</strong>
					<strong id="minute_show"><s></s>0分</strong>
					<strong id="second_show"><s></s>0秒</strong>
				</div>
                <div class="lynn-goods-head-user">
                    <div class="lynn-goods-head-user-top fui-list">
                </div>
                <div class="detail-info content content-images">
                    <div class="detail-info-title"><span>活动详情</span></div>
					<div class="content-block content-images" ng-bind-html="trust(pagedata.act.content)"></div>
                </div>
            </div>
        </div>

		<div class="fui-cell-group  fui-sale-group">
			<div class="fui-cell">
				<div class="fui-cell-label ">选择数量</div>
					<div class="fui-cell-text bold" style="color:#333">
					{{pagedata.num}}件
					</div>
				<div class="fui-cell-remark noremark" onclick="$('#showspec').modal();" ng-click=""><i class="icon jinyunicon icon-icon-test"></i></div>
			</div>
		</div>

    </div>
        <div class="fui-navbar footer-nav bordert" style="z-index:10;padding:0;">
            <a ng-click="access_json('jy_weishop_cutprice/index/')"  class="nav-item home-btn" data-nocache="true">
                <span class="icon jinyunicon icon-shouye"></span>
                <span class="label">全部竞拍活动</span>
            </a>
			 <a ng-click="access_json('jy_weishop_cutprice/home/')" class="nav-item home-btn">
                <span class="icon jinyunicon icon-wo1"></span>
                <span class="label">我的</span>
            </a>
            <a ng-if="pagedata.status==1" ng-click="pagedata.check();" class="nav-item lynn-bargain-a lynn-bargain-share-a external">
			<div class="fee-tagup-nav">
				立即拿下
			</div>
			</a>
            <a ng-if="pagedata.status==0" class="nav-item lynn-bargain-a lynn-bargain-now-a">
			<div class="fee-disabled-nav">
			尚未开始
			</div>
			</a>
            <a ng-if="pagedata.status==3" href="" class="nav-item lynn-bargain-a lynn-bargain-now-a">
			<div class="fee-disabled-nav">
			已经结束
			</div>
			</a>
            <a ng-if="pagedata.status==4" href="" class="nav-item lynn-bargain-a lynn-bargain-now-a">
			<div class="fee-disabled-nav">
			库存不足
			</div>
			</a>
        </div>
</div>
<div ng-if="pagedata.showrule" class="popup">
	<div class="popup-body">
		<div class="popup-center" style="min-height:18rem">
			<i class="closed icon icon-cuowu" ng-click="pagedata.showrule=false"></i>
			<div class="fui-article-page" style="background:none">
					<div class="fui-article-title" style="text-align:center">降价拍规则</div>
					<div class="fui-article-content" ng-bind-html="trust(pagedata.set.rule)"></div>
			</div>
		</div>
	</div>
</div>
<div id="showspec" class="modal fade" tabindex="-1" style="z-index:99999;display:none;">
<div class="modal-dialog" style="width:100%;left:0;bottom:0">
<div class="modal-content">
    <div class="option-picker ">
	<div class="option-picker-inner">
	<div class="option-picker-cell goodinfo">
	    <div class="closebtn"><i class="icon icon-guanbi1"></i></div>
	    <div class="img"><img class='thumb' src="{{tomedia(pagedata.act.image)}}" /></div>
	    <div class="info info-price text-danger">
			<span>
				￥
				<span class='price' style="font-weight:600">
				{{pagedata.act.nowprice}}
				</span>
			</span>
		</div>
	    <div class="info info-total">
	    	库存 <span class='total'>{{pagedata.act.total}}</span> 件
	    </div>
	<div class="info info-titles" ng-if="pagedata.specs.length>0">请选择规格</div>
	</div>
	<div class="option-picker-options">
		<div class="fui-cell-group noborder" style="margin-top:0">
			<div class="fui-cell noborder">
			<div class="fui-cell-label">数量</div>
			<div class="fui-cell-info"></div>
			<div class="fui-cell-mask noremark">
				 <div class="fui-number">
					<div class="minus" ng-click="pagedata.minus()">-</div>
					<input class="num" type="tel" name="" value="{{pagedata.num}}"/>
					<div class="plus" ng-click="pagedata.plus()">+</div>
				</div>
			</div>
			</div>
		</div>
	</div>
	<div class="fui-navbar">
	    <a href="javascript:;" aria-hidden="true" data-dismiss="modal" class="nav-item btn confirmbtn">确定</a>
	</div>
    </div>
    </div>

</div>
</div>
</div>
<script type="text/javascript">

require(['bootstrap', 'hammer'], function($, Hammer){
	$('#carousel-container').carousel();
	var mc = new Hammer($('#carousel-container').get(0));
	mc.on("panleft", function(ev) {
		$('#carousel-container').carousel('next');
	});
	mc.on("panright", function(ev) {
		$('#carousel-container').carousel('prev');
	});
});
scope.pagedata.minus=function(){
	if(scope.pagedata.num <=1){
		return false;
	}
	scope.pagedata.num--;
	scope.$evalAsync();
}
//增加
scope.pagedata.plus=function(){

	scope.pagedata.num++;
	//限购
	if(scope.pagedata.num > scope.pagedata.canbuy){
		scope.message('您的最大购买数量：'+scope.pagedata.act.buynum,'error');
		scope.pagedata.num--;
	}
	scope.$evalAsync();
}
scope.pagedata.check=function(){
	var params={
		data:{'actid':scope.pagedata.act.id,'num':scope.pagedata.num,'price':scope.pagedata.act.nowprice},
		op:'check',
		callback:function(res){

						if(res.type==1){
							scope.message('','','jy_weishop_cutprice/create//actid='+res.actid+'&price='+res.price+'&num='+res.num);
							
						}else{
							scope.message('您还有该商品订单等待支付!','error','jy_weishop_cutprice/order//status=0');
						}
				
				
			
		}
	};
	scope.post_json(params);

}
</script>
<script type="text/javascript">
				var intDiff = parseInt(scope.pagedata.intDiff);//倒计时总秒数量
				function timer(intDiff){
					window.setInterval(function(){
					var day=0,
						hour=0,
						minute=0,
						second=0;//时间默认值		
					if(intDiff > 0){
						day = Math.floor(intDiff / (60 * 60 * 24));
						hour = Math.floor(intDiff / (60 * 60)) - (day * 24);
						minute = Math.floor(intDiff / 60) - (day * 24 * 60) - (hour * 60);
						second = Math.floor(intDiff) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60);
					}
					if (minute <= 9) minute = '0' + minute;
					if (second <= 9) second = '0' + second;
					$('#day_show').html(day+"天");
					$('#hour_show').html('<s id="h"></s>'+hour+'时');
					$('#minute_show').html('<s></s>'+minute+'分');
					$('#second_show').html('<s></s>'+second+'秒');
					intDiff--;
					}, 1000);
				} 
				$(function(){
					if(intDiff >0){
						timer(intDiff);
					}
				});	
</script>